﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SCRUM.Core.BusinessObjects;

namespace SCRUM.Core.DAO
{
    /// <summary>
    /// DAO for role
    /// </summary>
    public static class DAORole
    {
        /// <summary>
        /// Gets all roles.
        /// </summary>
        /// <returns>List of all roles.</returns>
        public static List<Role> GetAllRoles(bool teamRolesOnly)
        {

            return MembershipProviders.MembershipProviderFactory.RoleProvider.GetRoles(teamRolesOnly);
        }

        /// <summary>
        /// Gets the role by ID.
        /// </summary>
        /// <param name="id">The identifier of the role.</param>
        /// <returns>Role based on specified ID.</returns>
        public static Role GetRoleByID(int id)
        {
            return MembershipProviders.MembershipProviderFactory.RoleProvider.GetRoleByID(id);
        }

        /// <summary>
        /// Gets the role for user.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <returns>Role for specified user.</returns>
        public static Role GetRoleForUser(User user)
        {
            return MembershipProviders.MembershipProviderFactory.RoleProvider.GetRoleForUser(user);
        }
    }
}
